home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / earcd / comm / ums / pint.lha / UMS / Rexx / FindParked.pint < prev    next >
Text File  |  1997-03-04  |  4KB  |  192 lines

  1. /****** FindParked.pint ************************************************************
  2.  
  3.     NAME
  4.       $VER: FindParked.pint 1.0 (21.2.96)
  5.  
  6.     Updated for PINT (22.2.97):
  7.      Magnus Heino (nd95mho@Student.HGS.SE)
  8.  
  9.     AUTHOR
  10.       Olaf Peters
  11.       Kulmer Str. 7
  12.       28237 Bremen
  13.  
  14.       op@hb2.maus.de / olf@informatik.uni-bremen.de
  15.  
  16.     SYNOPSIS
  17.       Find all readable messages that have the "Parked" flag set for the
  18.       current user.
  19.  
  20.  
  21.     FUNCTION
  22.  
  23.       You will be asked if you want to display just the messages you have
  24.       written (i.e. you are owner of) or all messages with the Parked flag
  25.       set.
  26.  
  27.       The latter option has been implemented, beceause I sometimes use the
  28.       Parked flag as a second postponed flag, so if I just scan for the
  29.       message I'm owner of, I would not see these.
  30.  
  31.  
  32.     CONFIGURATION
  33.       to be called from PINT's groupwindow:
  34.  
  35.       ums.config Example:
  36.  
  37.       ( PINT.Rexx
  38.         "GroupWindow     F1     UMS:Rexx/FindParked\n"
  39.       )
  40.  
  41.     NEEDS
  42.       For this script are needed:
  43.  
  44.       · PINT v2.0
  45.       · UMSServer v11.20 or above (using the UMSDupAccount trick for login)
  46.  
  47.     BUGS
  48.       none known. Please mail any problems to the above address.
  49.  
  50.     $HISTORY:
  51.  
  52.      21.2.96  1.0   : initial
  53.  
  54. ******************************************************************************
  55. *
  56. */
  57.  
  58. ProgramName = "FindParked.pint"
  59. lf = '0a'x
  60.  
  61. /*** Startup ***/
  62.  
  63. options results
  64.  
  65. RC = 0
  66. account = 0
  67.  
  68. signal on BREAK_C
  69. signal on BREAK_D
  70. signal on BREAK_E
  71. signal on BREAK_F
  72. signal on ERROR
  73. signal on HALT
  74. signal on IOERR
  75. signal on SYNTAX
  76.  
  77. scanning = 0
  78. account  = 0
  79.  
  80. /*/// "add libs" */
  81.  
  82. libname = "ums.library"
  83. if ~show("L", "ums.library") then do
  84.   if ~addlib("ums.library", 0, -210, 8) then do
  85.     say "ums.library not found!"
  86.     exit(20)
  87.   end
  88. end
  89. call UMSInitConsts
  90.  
  91. /*\\\*/
  92.  
  93. /*/// "duplicate login" */
  94.  
  95. 'info screen'
  96. screen = result
  97.  
  98. 'status'
  99. if result ~= "GROUP" then do
  100.     'request' ProgramName '"*Cancel" "This script may only be called from the groupwindow."'
  101.     call HALT
  102. end
  103.  
  104. 'getaccount'
  105. if (result = "RESULT") | (result = 0) then do
  106.     'request' ProgramName '"*Cancel" "Cannot get account!"'
  107.     call HALT
  108. end ; else
  109.     login = result
  110.  
  111. account = UMSLogin("", login, "")
  112. if account = 0 then do
  113.     'request' ProgramName '"*Cancel" "Cannot duplicate account!"'
  114.     call HALT
  115. end
  116.  
  117. /*\\\*/
  118.  
  119. 'request' ProgramName '"**_All|_Own" "All parked messages or just your own?"'
  120.  
  121. own = (result ~= 1)
  122.  
  123. /* Clear all flags */
  124. res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(), UMSMakeFlags(0,1,2),,, "LOCAL", UMSMakeFlags(), UMSMakeFlags())
  125.  
  126. /* set flag 1 on all parked messages */
  127. res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(1), UMSMakeFlags(),,, "GLOBAL", UMSMakeFlags(UMSGSTAT_Parked), UMSMakeFlags(UMSGSTAT_Parked))
  128.  
  129. if own then
  130.     /* set flag 2 on all messages the current user is owner of */
  131.     res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(2), UMSMakeFlags(),,, "USER", UMSMakeFlags(UMSUSTAT_Owner), UMSMakeFlags(UMSUSTAT_Owner))
  132.  
  133. if own then
  134.     /* merge the sets to get all parked messages the current user is owner of */
  135.     res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, "LOCAL", UMSMakeFlags(1,2), UMSMakeFlags(1,2))
  136. else
  137.     res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, "LOCAL", UMSMakeFlags(1), UMSMakeFlags(1))
  138.  
  139. if res = 0 then do
  140.     'request' ProgramName '"**Cancel" "No parked messages found."'
  141.     call HALT
  142. end
  143.  
  144. 'beginscan'
  145. scanning = 1
  146.  
  147. msgnum = 0
  148.  
  149. do forever
  150.   msgnum = UMSSearchFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(0), msgnum)
  151.   if msgnum = 0 then
  152.     leave
  153.   'scanmsg' msgnum
  154. end /* do forever */
  155.  
  156. /*/// "Final cleanup" */
  157.  
  158. BREAK_C:
  159. BREAK_D:
  160. BREAK_E:
  161. BREAK_F:
  162. ERROR:
  163. HALT:
  164. IOERR:
  165. SYNTAX:
  166.  
  167. /*** Logout ***/
  168.  
  169. if scanning ~= 0 then do
  170.   'endscan'
  171.   scanning = 0
  172. end /* if */
  173.  
  174. if account ~= 0 then do
  175.   call UMSLogout(account)
  176.   account = 0
  177. end
  178.  
  179. exit 0
  180.  
  181. /*** Support ***/
  182.  
  183. CheckErr: procedure expose account
  184.   err = UMSErrNum(account)
  185.   if err ~= 0 then do
  186.     'request' ProgramName '"*Cancel" "UMS Error #' || err || ': ' || UMSErrTxt(account)'"'
  187.   end
  188. return
  189.  
  190. /*\\\*/
  191.  
  192.